import type { LoginType } from '@/enums/request.enums';
import { useUserStore } from '@/store/userStore';
import { BaseRequest } from './baseRequest';

export class NormalRequest extends BaseRequest {
  constructor(clientId: string, clientSecret: string, loginType: LoginType) {
    super(clientId, clientSecret, loginType);
  }

  getToken(): string {
    return useUserStore().getAuthStore().accessToken;
  }

  getRefreshTokenValue(): string {
    return useUserStore().getAuthStore().refreshToken;
  }

  handleAuthorized(): void {
    // 清除用户信息
    useUserStore().resetAuth();
  }

  setTokenValue(accessToken: string, refreshToken: string): void {
    useUserStore().setAuthStore(accessToken, refreshToken);
  }
}
